#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>

/**
 * Name of the named fifo
 */
#define NAMED_FIFO "fifo"

int main(int argc, char **argv) {
	int fd;
	char buf[1];
	
	if ((fd = open(NAMED_FIFO, O_RDONLY)) == -1) {
		perror("open()");
		exit(EXIT_FAILURE);
	}
	
	while (read(fd, buf, 1)) {
		write(STDOUT_FILENO, buf, 1);
	}

	close(fd);
	exit(EXIT_SUCCESS);
}